from django.contrib import admin
from import_export import resources
from import_export.admin import ImportExportModelAdmin
from apps.organization.models import Teacher, CourseOrg, City


# Register your models here.

@admin.register(Teacher)
class TeacherAdmin(ImportExportModelAdmin):
    list_display = ['org', 'name', 'work_years', 'work_company']
    search_fields = ['org', 'name', 'work_years', 'work_company']
    list_filter = ['org', 'name', 'work_years', 'work_company']


class TeacherResource(resources.ModelResource):
    class Meta:
        model = Teacher


@admin.register(CourseOrg)
class CourseOrgAdmin(ImportExportModelAdmin):
    list_display = ['name', 'desc', 'click_nums', 'fav_nums']
    search_fields = ['name', 'desc', 'click_nums', 'fav_nums']
    list_filter = ['name', 'desc', 'click_nums', 'fav_nums']


class OrgResource(resources.ModelResource):
    class Meta:
        model = CourseOrg


@admin.register(City)
class CityAdmin(admin.ModelAdmin):
    list_display = ["id", "name", "desc"]
    search_fields = ["name", "desc"]
    list_filter = ["name", "desc", "add_time"]
    list_editable = ["name", "desc"]
